import useServer from "server";
import { ProjectType } from "types";
import { useQuery } from "react-query";

export const useTask = (id?: number) => {
  const client = useServer();

  return useQuery<ProjectType>(
    ["tasks", { id }],
    () => {
      return client(`tasks/${id}`);
    },
    { enabled: !!id }
  );
};
